/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.marlboroug.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;


@Entity
@Table(name = "Articles_ordered")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Articlesordered.findAll", query = "SELECT a FROM Articlesordered a"),
    @NamedQuery(name = "Articlesordered.findByIDarticlesordered", query = "SELECT a FROM Articlesordered a WHERE a.iDarticlesordered = :iDarticlesordered"),
    @NamedQuery(name = "Articlesordered.findByQuantityArticle", query = "SELECT a FROM Articlesordered a WHERE a.quantityArticle = :quantityArticle")})
public class Articlesordered implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_articles_ordered")
    private Long iDarticlesordered;
    @Basic(optional = false)
    @NotNull
    @Column(name = "quantity_article")
    private int quantityArticle;
    @JoinColumn(name = "id_articles", referencedColumnName = "ID_articles")
    @ManyToOne(optional = false)
    private Articles idArticles;
    @JoinColumn(name = "id_orders", referencedColumnName = "ID_orders")
    @ManyToOne(optional = false)
    private Orders idOrders;

    public Articlesordered() {
    }

    public Articlesordered(Long iDarticlesordered) {
        this.iDarticlesordered = iDarticlesordered;
    }

    public Articlesordered(Long iDarticlesordered, int quantityArticle) {
        this.iDarticlesordered = iDarticlesordered;
        this.quantityArticle = quantityArticle;
    }

    public Long getIDarticlesordered() {
        return iDarticlesordered;
    }

    public void setIDarticlesordered(Long iDarticlesordered) {
        this.iDarticlesordered = iDarticlesordered;
    }

    public int getQuantityArticle() {
        return quantityArticle;
    }

    public void setQuantityArticle(int quantityArticle) {
        this.quantityArticle = quantityArticle;
    }

    public Articles getIdArticles() {
        return idArticles;
    }

    public void setIdArticles(Articles idArticles) {
        this.idArticles = idArticles;
    }

    public Orders getIdOrders() {
        return idOrders;
    }

    public void setIdOrders(Orders idOrders) {
        this.idOrders = idOrders;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (iDarticlesordered != null ? iDarticlesordered.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Articlesordered)) {
            return false;
        }
        Articlesordered other = (Articlesordered) object;
        if ((this.iDarticlesordered == null && other.iDarticlesordered != null) || (this.iDarticlesordered != null && !this.iDarticlesordered.equals(other.iDarticlesordered))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.marlboroug.entity.Articlesordered[ iDarticlesordered=" + iDarticlesordered + " ]";
    }
    
}
